<#macro select list value=-1 listKey="id" listValue="name" search=0 placeholder="-=请选择=-">
<#assign strValue=value?string/>
	<#if search != 0>
		<option value="">${placeholder}</option>
	</#if>
	<#if list??>
		<#if list?is_hash>
			<#list list as k, v>
				<#if strValue != "-1" && strValue == k>
					<option value="${k}" selected="selected">${v}</option>
				<#else>
					<option value="${k}">${v}</option>
				</#if>
			</#list>
		<#else>
			<#list list as k>
				<#if value != -1 && value == k[listKey]>
					<option value="${k[listKey]}" selected="selected">${k[listValue]}</option>
				<#else>
					<option value="${k[listKey]}">${k[listValue]}</option>
				</#if>
			</#list>
		</#if>
	</#if>
</#macro>


<#macro pagebar page url searchId="#div_search" gridId="#div_grid">

<script>
function blue_page_onchange(p)
{
	var obj = $.getObject("${searchId}");
	obj.start = p;
	$("${gridId}").simpleLoad("${url}", obj, 1);
}
</script>

<div class="am-u-sm-6">
		<p class="am-margin-top am-text-lg">每页 <strong>${page.size!}</strong> 条记录 / 共 <strong>${page.rows!}</strong> 条记录</p>
	</div>
	<div class="am-u-sm-6">
		<ul class="am-pagination am-pagination-right">

<#-- 第一页 -->
<#if page.curPage == 1>
	<li class="am-disabled"><a href="javascript:void(0)">&laquo;</a></li>
	<li class="am-active"><a href="javascript:void(0)">1</a></li>
<#else>
	<li><a href="javascript:void(0)" onclick="blue_page_onchange(1)">&laquo;</a></li>
	<li><a href="javascript:void(0)" onclick="blue_page_onchange(1)">1</a></li>
</#if>

<#if page.curPage &gt; 5>
	<li class="am-disabled"><a href="javascript:void(0)">...</a></li>
</#if>

<#if page.totalPage &gt; 1>
	<#assign start = page.curPage - 3/>
	<#if start &lt; 2>
		<#assign start = 2/>
	</#if>
	<#assign end = page.curPage + 3/>
	<#if end &gt; page.totalPage - 1>
		<#assign end = page.totalPage - 1/>
	</#if>

	<#if start <= end>
		<#list start .. end as i>
			<#if page.curPage == i>
				<li class="am-active"><a href="javascript:void(0)">${i}</a></li>
			<#else>
				<li><a href="javascript:void(0)" onclick="blue_page_onchange(${i})">${i}</a></li>
			</#if>
		</#list>
	</#if>
	
	<#if page.curPage &lt; page.totalPage - 4 >
		<li class="am-disabled"><a href="javascript:void(0)">...</a></li>
	</#if>
	
	<#-- 最后一页 -->
	<#if page.curPage == page.totalPage>
		<li class="am-active"><a href="javascript:void(0)">${page.totalPage}</a></li>
		<li class="am-disabled"><a href="javascript:void(0)">&raquo;</a></li>
	<#else>
		<li><a href="javascript:void(0)" onclick="blue_page_onchange(${page.totalPage})">${page.totalPage}</a></li>
		<li><a href="javascript:void(0)" onclick="blue_page_onchange(${page.totalPage})">&raquo;</a></li>
	</#if>

<#else>
		<li class="am-disabled"><a href="javascript:void(0)">&raquo;</a></li>
</#if>

</ul>
</div>
</#macro>